package com.shu.solr;

import java.io.IOException;

import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrQuery.ORDER;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;

public class TestSinge {

	public static void main(String[] args) throws Exception {
		final String solrUrl = "http://192.168.1.14:8984/solr/weighthistory_day";
		
		HttpSolrClient client = new HttpSolrClient.Builder(solrUrl)
			    .withConnectionTimeout(10000)
			    .withSocketTimeout(60000)
			    .build();


		SolrQuery query = new SolrQuery("*:*");  
		query.setRows(1);
		query.setStart(-1);//e2f6a5811f3745cb8f656e7c6ee5fadf  2330837573a247e988045fe32a06229d
		query.addSort("create_time", ORDER.asc);
        QueryResponse resp = client.query(query);  
        System.out.println(resp);
	}
}
